    //Random Game Engine
    //Copyright (C) 2012  Nikolay Dionisov

    //This program is free software: you can redistribute it and/or modify
    //it under the terms of the GNU General Public License as published by
    //the Free Software Foundation, either version 3 of the License, or
    //(at your option) any later version.

    //This program is distributed in the hope that it will be useful,
    //but WITHOUT ANY WARRANTY; without even the implied warranty of
    //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    //GNU General Public License for more details.

    //You should have received a copy of the GNU General Public License
    //along with this program.  If not, see <http://www.gnu.org/licenses/>.

	//------------------------------------------------------------------------

	//FILE NAME: RandomEngine.h
	//Definition of the main class of this engine/library.
	//Taking care of other system's initializing, lifespan and destruction.

#pragma once
#include "BasicTypes\BaseTypes.h"
#include "CoreInterfaces.h"
#include "..\config.h"
#include "OSFramework\BaseFramework.h"
#ifdef RE_ENABLE_CORE_WINDOWS
#include "OSFramework\Frameworks\WinFramework.h"
#endif
#ifdef RE_ENABLE_CORE_LINUX // there are no linux support plans, however this will stay here
#include "OSFramework\Frameworks\linux.h"
#endif
#include "Synchronization\ThreadPool.h"
#include "..\IO\ResourceCache\ResourceCacheProcess.h"
#include "Logger\LoggerMain.h"
#include "EventManager\Events\GeneralEvents.h"
namespace re
{
	namespace core
	{
		class RandomEngine;
		typedef std::tr1::shared_ptr<IOSFramework<RandomEngine>> OSFrameworkPtr;
		//--------------------------------------------------------------------------------------------------------
		//re::core::RandomEngine - The core engine class, which is managing all subsystems.
		//--------------------------------------------------------------------------------------------------------
		class RandomEngine
		{
		public:
			RandomEngine() {}
			~RandomEngine() {}
			//--------------------------------------------------------------------------------------------------------
			//Functions for initializing and running the engine.
			//--------------------------------------------------------------------------------------------------------
			bool Initialize();
			int RunEngine();
			//--------------------------------------------------------------------------------------------------------
			//Private Functions, controlling the subsystems.
			//--------------------------------------------------------------------------------------------------------
		private:
			bool ShutDown();
			virtual bool UpdateEngineProperties();
			virtual bool CreateGameAndView();

			bool Update();
			void Render();
			void CreateDevice(IRenderer * renderer);
			void DestroyDevice();
			void LostDevice();
			void ResetDevice();

			//--------------------------------------------------------------------------------------------------------
			//Private Members
			//--------------------------------------------------------------------------------------------------------
			AppSettings settings_;
			OSFrameworkPtr osframework_;
			EventManager eventmanager_;
			ThreadPool pool_;
		};
	}
}